package top.zhangjianyong.blog.service;

import com.baomidou.mybatisplus.extension.service.IService;
import java.time.LocalDateTime;
import java.util.List;
import java.util.concurrent.ExecutionException;
import top.zhangjianyong.blog.entity.dto.BlogDTO;
import top.zhangjianyong.blog.entity.po.Blog;
import top.zhangjianyong.blog.params.blog.*;
import top.zhangjianyong.blog.response.ApiResponse;

/**
 * 博客
 *
 * @author zhangjianyong
 * @since 2024/7/31 下午8:47
 */
public interface BlogService extends IService<Blog> {

  ApiResponse page(BlogPageParam param) throws ExecutionException, InterruptedException;

  ApiResponse portalPage(BlogPageParam param) throws ExecutionException, InterruptedException;

  ApiResponse topList(BlogTopListParam param) throws ExecutionException, InterruptedException;

  ApiResponse remove(BlogRemoveParam param);

  ApiResponse saveOrUpdate(BlogSaveOrUpdateParam param);

  void clearCategory(Long categoryId);

  ApiResponse statusChange(BlogStateChangeParam param);

  ApiResponse push(BlogPushParam param);

  ApiResponse top(BlogTopParam param);

  ApiResponse get(BlogGetParam param);

  List<Blog> listByTag(Long tagId);

  Long countByTag(Long tagId);

  long countByUser(Long userId);

  LocalDateTime getLastBlogPushTime(Long id);

  void addVisit(Long blogId, Integer type);

  /**
   * 统计分类下已发布的博客数量
   *
   * @param categoryId 分类ID
   * @return 博客数量
   */
  long countByCategory(Long categoryId);

  List<BlogDTO> listPublished();
}
